﻿package 
{
	import flash.display.BitmapData;
	import flash.display.Shape;
	import flash.display.Sprite;
	import flash.geom.Matrix;
	
	/**
	 * ...
	 * @author leon.yu
	 */
	public class Cover extends Sprite
	{
		static public const IDENTIFY:Matrix = new Matrix();
		
		private var _pattern:BitmapData;
		private var _canvas:Shape;
		
		public function Cover() 
		{
			_pattern = new BitmapData(2, 2, true, 0);
			_pattern.lock();
			_pattern.setPixel32(0, 0, 0xFF000000);
			_pattern.setPixel32(0, 1, 0x7F000000);
			_pattern.setPixel32(1, 0, 0x7F000000);
			_pattern.setPixel32(1, 1, 0xFF000000);
			_pattern.unlock();
			_canvas = new Shape();
			addChild(_canvas);
		}
		
		public function setSize(w:Number, h:Number):void
		{
			_canvas.graphics.clear();
			_canvas.graphics.beginBitmapFill(_pattern, IDENTIFY, true, false);
			_canvas.graphics.drawRect(0, 0, w, h);
			_canvas.graphics.endFill();
		}
		
	}

}